const fs = require('fs')

// Ctrl+Window+T 函数快捷键

/**
 * @description: 
 * @param {*} path
 * @return {} promise对象
 */
function myReadFile(path) {
    return new Promise((resolve, reject) => {
        fs.readFile(path, ((err, data) => {
            if (err) reject(err)
            resolve(data)
        }))
    })
}

myReadFile('./content.txt').then((value) => {
    console.log(value.toString()); 
}, (reason) => {
    console.log(reason);
}) 